using System.Collections.Generic;

namespace WWB.SitePointPrivateMessages.Core.Infrastructure.Logging
{
    public class StringLogger : ILogger
    {
        private readonly List<string> data = new List<string>();

        #region Implementation of ILogger

        public void LogMessage(string message)
        {
            data.Add(message);
        }

        public void LogMessage(string message, object param)
        {
            data.Add(string.Format(message + "\n", param));
        }

        public void LogMessage(string messageFormat, object[] messageParams)
        {
            data.Add(string.Format(messageFormat, messageParams));
        }

        public void LogError(string error)
        {
            data.Add(error);
        }

        public void LogError(string message, object param)
        {
            data.Add(string.Format(message + "\n", param));
        }

        public void LogError(string messageFormat, object[] messageParams)
        {
            data.Add(string.Format(messageFormat, messageParams));
        }

        public void Clear()
        {
            data.Clear();
        }

        public IEnumerable<string> Messages()
        {
            return data;
        }

        #endregion
    }
}